<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="com.jiadakeji.ppm.modules.sys.utils.*" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>应收台账管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#btnImport").click(function(){
				$.jBox($("#importBox").html(), {title:"导入数据", buttons:{"关闭":true},
					bottomText:"导入文件不能超过5M，仅允许导入“xls”或“xlsx”格式文件！"});
			});

			$("#btnImportReceive").click(function(){
				$.jBox($("#importBox1").html(), {title:"导入数据", buttons:{"关闭":true},
					bottomText:"导入文件不能超过5M，仅允许导入“xls”或“xlsx”格式文件！"});
			});
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
	</script>
</head>
<body>
<div id="importBox" class="hide">
	<form id="importForm" action="${ctx}/business/feeCharge/import" method="post" enctype="multipart/form-data"
		  class="form-search" style="padding-left:20px;text-align:center;" onsubmit="loading('正在导入，请稍等...');"><br/>
		<input id="uploadFile" name="file" type="file" style="width:330px"/><br/><br/>　　
		<input id="btnImportSubmit" class="btn btn-primary" type="submit" value="   导    入   "/>
	</form>
</div>
<div id="importBox1" class="hide">
	<form id="importForm1" action="${ctx}/business/feeCharge/importReceive" method="post" enctype="multipart/form-data"
		  class="form-search" style="padding-left:20px;text-align:center;" onsubmit="loading('正在导入，请稍等...');"><br/>
		<input id="uploadFile1" name="file" type="file" style="width:330px"/><br/><br/>　　
		<input id="btnImportSubmit1" class="btn btn-primary" type="submit" value="   导    入   "/>
	</form>
</div>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/business/feeCharge/">应收台账列表</a></li>
		<shiro:hasPermission name="business:feeCharge:edit"><li><a href="${ctx}/business/feeCharge/form">应收台账添加</a></li></shiro:hasPermission>
	</ul>
	<form:form id="searchForm" modelAttribute="feeCharge" action="${ctx}/business/feeCharge/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
			<li><label>小区：</label>
				<form:select path="room.communityId" class="input-xlarge ">
					<form:option value="" label="请选择"/>
					<form:options items="${fns:getCommunityList()}" itemLabel="name" itemValue="id" htmlEscape="false"/>
				</form:select>
			</li>
			<li><label>楼栋：</label>
				<input type="hidden" name="hidden_buildingId" value="${feeCharge.room.buildingId}"/>
				<form:select path="room.buildingId" class="input-medium">
					<form:option value="">请选择</form:option>
				</form:select>
			</li>
			<li><label>房屋号：</label>
				<form:input path="room.code" htmlEscape="false" maxlength="32" class="input-medium"/>
			</li>
			<li><label>缴费月份ID：</label>
				<form:select path="feeMonthId" class="input-medium">
					<form:option value="" label=""/>
					<form:options items="${fns:getFeeMonthList()}" itemLabel="monthString" itemValue="id" htmlEscape="false"/>
				</form:select>
			</li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
				<input id="btnImport" class="btn btn-primary" type="button" value="导入"/>
				<input id="btnImportReceive" class="btn btn-primary" type="button" value="导入已收"/>
			</li>

			<li class="clearfix"></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>小区</th>
				<th>楼栋</th>
				<th>房屋</th>
				<th>缴费人</th>
				<th>缴费月份</th>
				<th>物业管理费</th>
				<th>均摊电费</th>
				<th>均摊水费</th>
				<th>二次加压电费</th>
				<th>电梯费</th>
				<th>车辆费用</th>
				<th>总费用</th>
				<th>发布时间</th>
				<th>违约金</th>
				<th>状态</th>
				<shiro:hasPermission name="business:feeCharge:edit"><th>操作</th></shiro:hasPermission>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="feeCharge">
			<tr>
				<td>
					${feeCharge.communityName}
				</td>
				<td>
					${feeCharge.buildingName}
				</td>
				<td>
					${feeCharge.room.code}
				</td>
				<td>
						${feeCharge.customerName}
				</td>
				<td>
					<fmt:formatDate value="${feeCharge.feeMonth.currentMonth}" pattern="yyyy-MM"/>
				</td>
				<td>
					${feeCharge.manageFee}
				</td>
				<td>
					${feeCharge.avgElecFee}
				</td>
				<td>
					${feeCharge.avgWaterFee}
				</td>
				<td>
					${feeCharge.secondPushElecFee}
				</td>
				<td>
					${feeCharge.elevatorFee}
				</td>
				<td>
					${feeCharge.carMonthFee}
				</td>
				<td>
					${feeCharge.totalFee}
				</td>
				<td>
					<fmt:formatDate value="${feeCharge.publishDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<td>
					${feeCharge.feebackMoney}
				</td>
				<td>
						${fns:getDictLabel(feeCharge.status,"fee_charge_status" ,"" )}

				</td>
				<shiro:hasPermission name="business:feeCharge:edit"><td>
					<a href="${ctx}/business/feeCharge/reCalFeeCharge?id=${feeCharge.id}" onclick="return confirmx('确认要重新算费该应收台账吗？', this.href)">重新算费</a>
    				<c:if test="${feeCharge.status != '2'}"> <a href="${ctx}/business/feeCharge/form?id=${feeCharge.id}">收费</a>

					</c:if>
					<a href="${ctx}/business/feeCharge/delete?id=${feeCharge.id}" onclick="return confirmx('确认要删除该应收台账吗？', this.href)">删除</a>
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		<tr>
			<td>总价：</td>
			<td>${total}</td>
		</tr>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
	<script src="${pageContext.request.contextPath}/static/common/list_relate.js"></script>
	<script>
        jQuery(function($) {
            // 选择联动
            var parameter = {
                url : "/a/business/building/getBuildingList",
                key : "communityId",
                // dataList:"schoolList",
                value : "id",
                text : "name",
                selectedVal : ""
            };
            $("select[name='room.communityId']").ajaxRelate(
                $("select[name='room.buildingId']"), parameter);
            $("select[name='room.buildingId']").val($("input[name='hidden_buildingId']").val()).trigger("change");


        });
	</script>
</body>
</html>